<?php
namespace Home\Controller;
class IndexController extends CommonController {
	public function index(){
		// BANNER
		$this->banner    = D('Banner')->get_list('web_index');
		// 选择我们
		$this->choose_us_link = D('Banner')->get_list('choose_us_link');
		$this->choose_us_info = D('Article')->get_page_content('choose_us_description', '');
		// 创业合同
		$this->entrepreneurial_list = D('Banner')->get_list('web_home_entrepreneurial');
		// 专项法律服务
		$this->special_agreement_list = D('CustomAgreement')->get_list(array('category_id' => '100'), '', 1, 4);
		$this->display();
	}

	public function entrepreneurial_list(){
		$sort_list = D('Category')->get_list('index_entrepreneurial', 4);
		foreach ($sort_list as $rs) {
			$rs['list'] = D('Banner')->get_list('index_entrepreneurial', '', $rs['id']);
			$new_list[] = $rs;
		}

		return $new_list ? $new_list : array();
	}

	// public function import(){
	// 	//导出Excel数据
	// 	import("ExcelUtil", 'Public/Class/suncco/');
	// 	$excel = new \ExcelUtil();
	// 	$list = $excel->import('user.xls');
	// 	$data = array();
	// 	foreach ($list as $rs) {
	// 		$email    = $rs[0];
	// 		$mobile   = $rs[1];
	// 		$password = $rs[2];
	// 		if(!D('User')->mobile_exists($mobile) && $mobile && $password){
	// 			$user_id = D('User')->generate_user_id();
	// 			$row['user_id']     = $user_id;
	// 			$row['email']       = $email ? $email : '';
	// 			$row['mobile']      = $mobile;
	// 			$row['password']    = password_md5_one($user_id, $password);
	// 			$row['create_time'] = time();
	// 			$data[] = $row;
	// 		}
	// 	}
	// 	// var_dump($data);exit;
	// 	if($data){
	// 		D('User')->addAll($data);
	// 		var_dump(count($data));
	// 	}
	// 	exit('fail');
	// }
}